const Router = require('koa-router')
const router = new Router({
  prefix: '/api'
})

let appData = require('./data.json')
let seller = appData.seller
let goods = appData.goods
let ratings = appData.ratings

router
  .get('/seller', async ctx => {
    ctx.body = {
      errno: 0,
      data: seller
    }
  })

  .get('/goods', async ctx => {
    ctx.body = {
      errno: 0,
      data: goods
    }
  })

  .get('/ratings', async ctx => {
    ctx.body = {
      errno: 0,
      data: ratings
    }
  })

module.exports = router